package com.google.shop.product.sms.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.CommonRequest;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;
import com.google.shop.product.sms.service.SmsService;
import java.util.Map;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

@Service
/* loaded from: app.jar:BOOT-INF/classes/com/google/shop/product/sms/service/impl/SmsServiceImpl.class */
public class SmsServiceImpl implements SmsService {
    @Override // com.google.shop.product.sms.service.SmsService
    public boolean send(Map<String, Object> param, String phone) {
        if (StringUtils.isEmpty(phone)) {
            return false;
        }
        IAcsClient client = new DefaultAcsClient(DefaultProfile.getProfile("default", "LTAI4FpzNSvMAqE5p2ss3TWg", "8OrZ51Jxmct1GR21cGXuTGEOoPqrXq"));
        CommonRequest request = new CommonRequest();
        request.setMethod(MethodType.POST);
        request.setDomain("dysmsapi.aliyuncs.com");
        request.setVersion("2017-05-25");
        request.setAction("SendSms");
        request.putQueryParameter("PhoneNumbers", phone);
        request.putQueryParameter("SignName", "弹性云计算");
        request.putQueryParameter("TemplateCode", "SMS_187271670");
        request.putQueryParameter("TemplateParam", JSONObject.toJSONString(param));
        try {
            return client.getCommonResponse(request).getHttpResponse().isSuccess();
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }
}
